#!/usr/bin/perl
use strict;
my $result=`cat /proc/meminfo`;
my @results=split("\n",$result);
# iterate and copy each one
foreach (@results){
chomp;
$_ =~ /^MemTotal:\s+(\d+)/i && print "$1\n";
$_ =~ /^MemFree:\s+(\d+)/i && print "$1\n";
$_ =~ /^SwapTotal:\s+(\d+)/i && print "$1\n";
$_ =~ /^SwapFree:\s+(\d+)/i && print "$1\n";
}
christo